<template>
  <div class="">
    <headMain :mensid="'2'" />

    <div class="big-div">
      <div
        @click="goitem(item)"
        class="small-div"
        v-for="item in rendata"
        :key="item.caseTypeId"
        v-show="
          item.caseTypeName != '测试分类勿删' && item.caseTypeName != '妇科'
        "
      >
        <div class="bigimg">
          <img :src="base + item.url" alt="" />
        </div>
        <div class="bigname">{{ item.caseTypeName }}</div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import headMain from '@/views/headmain/index.vue';
  import { caseType } from '@/api/case';
  import { useRouter } from 'vue-router';

  import { computed, ref, reactive } from 'vue';
  const base = ref((window as any).config.VUE_APP_IMG_API);
  const rendata = ref();
  const fetchData = () => {
    caseType({ pageSize: 99, pageNum: 1 }).then((res: any) => {
      if (res.code == 200) {
        rendata.value = res.data.list;
      }
    });
  };
  fetchData();

  const router = useRouter();

  const goitem = (item: any) => {
    router.push({
      name: 'caselist',
      query: {
        caseTypeName: item.caseTypeName,
        caseTypeId: item.caseTypeId,
      },
    });
  };
</script>

<style scoped>
  .big-div {
    width: 100%;
    margin: 30px auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 35px; /* 调整间距 */
    margin-top: 100px;
  }

  .small-div {
    cursor: pointer;
    width: 324px;
    height: 319px;
    background: #f5f6fa;
    border-radius: 10px;
    border: 1px solid #a3b0c1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .bigimg {
    width: 284px;
    height: 219px;
    overflow: hidden;
    border-radius: 10px;
    margin-top: 10px;
  }
  .bigimg img {
    width: 284px;
    height: 219px;
    overflow: hidden;
    border-radius: 10px;
  }
  .bigname {
    color: #3c4459;
    font-size: 18px;
    width: 280px;
    margin: 25px 0;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
</style>
